<template>
  <div>
    <h2>当前计数：{{ $store.state.counter }}</h2>
    <button @click="increment">+1</button>
    <button @click="decrement">-1</button>
  </div>
</template>

<script>
export default {
  mounted() {
    this.$store.dispatch("getHomeMultidata");
  },
  methods: {
    increment() {
      this.$store.dispatch("incrementAction");
    },
    decrement() {
      // 派发风格(对象类型)
      this.$store.dispatch({
        type: "decrementAction",
        info: { name: "pengfna", age: 18 },
      });
    },
  },
};
</script>

<style scoped>
</style>